package com.todo.member.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2025/2/12 15:13
 * @description
 */
@Getter
@AllArgsConstructor
public enum MemberVipBoughtStatusEnum {

    WAITING_PAY(1, "WAITING_PAY", "待支付"),
    PAY_FAILED(2, "PAY_FAILED", "支付失败"),
    PAY_SUCCESS(3, "PAY_SUCCESS", "支付成功"),
    EFFECTIVE(4, "EFFECTIVE", "已生效"),
    SUSPEND(5, "SUSPEND", "已暂停"),
    EXPIRED(6, "SHUTDOWN", "已过期"),
    ;

    private static Map<Integer, MemberVipBoughtStatusEnum> typeMap = Arrays
            .stream(MemberVipBoughtStatusEnum.values())
            .collect(Collectors.toMap(MemberVipBoughtStatusEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static MemberVipBoughtStatusEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
